import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '大发财',
    component: () => import('../views/main/index.vue'),
    redirect:'/classify',
    children:[
        {
            path:'/classify',
            name:'分类',
            component:() => import('../views/main/classify.vue')
        },
        {
            path:'/car',
            name:'购物车',
            component:() => import('../views/main/car.vue')
        },
        {
            path:'/my',
            name:'我的',
            component:() => import('../views/main/my.vue')
        }
    ]
  },
  {
    path: '/detail/:id',
    name: '详情',
    component: () => import('../views/detail.vue')
  },
  {
    path: '/address',
    name: '收获地址',
    component: () => import('../views/address.vue')
  },
  {
    path: '/addAddress',
    name: '添加地址',
    component: () => import('../views/addAddress.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  linkActiveClass:'active'
})

export default router
